package com.allwees.bs.c.configuration;

import com.allwees.bs.core.model.constant.CacheName;
import com.allwees.core.cache.configuration.InitialCache;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class CacheConfiguration extends InitialCache {

    /**
     * 配置各个Cache的生命周期
     *
     * @return
     */
    @Override
    protected Map<String, Integer> initialCaches() {
        Map<String, Integer> caches = new HashMap<>();
        caches.put(CacheName.PROD_PRODUCT_BY_UUID, 3600);
        caches.put(CacheName.PROD_SKU_BY_UUID, 3600);
        caches.put(CacheName.PROD_PRODUCT_DETAILS, 3600);
        caches.put(CacheName.PROD_PRODUCT_RELATED, 3600);
        caches.put(CacheName.PROD_PRODUCT_HOTS, 3600);
        caches.put(CacheName.PROD_PRODUCT_BELOW5, 3600);
        caches.put(CacheName.PROD_PRODUCT_FLASH, 600);
        caches.put(CacheName.APP_CATEGORY, 3600);
        caches.put(CacheName.APP_AGGREGATE, 300);
        caches.put(CacheName.PROD_SEARCH_KEY_PAGE, 3600);
        caches.put(CacheName.PROD_CATEGORY_PAGE, 3600);
        caches.put(CacheName.LOGIST_PROVIDER, 3600);

        caches.put(CacheName.USER_INIT_EMAIL_VERIFY_CODE, 60 * 15);
        caches.put(CacheName.USER_CHANGE_PWD_VERIFY_CODE, 60 * 15);
        return caches;
    }
}
